import 'dart:html';

import 'package:flutter/cupertino.dart';
import 'package:flutter_learn/learn/inherit/Config.dart';

class ConfigWidget extends InheritedWidget {
  ConfigWidget({Key? key, this.config, Widget? child}) : super(key: key, child: child!);

  final Config? config;

  static Config of(BuildContext context){
     ConfigWidget? configWidget=context.dependOnInheritedWidgetOfExactType<ConfigWidget>();
     return configWidget?.config?? Config();
  }

  @override
  bool updateShouldNotify(covariant InheritedWidget oldWidget) {
    return config!=(oldWidget as ConfigWidget).config;
  }
}
